home *** CD-ROM | disk | FTP | other *** search
- property sp, cst, pos, state, targetTimer, targetPoint, cherubPicList, lookDir, picTimer, pauseTimer, cherWingObj, weightObj
- global worldObj
-
- on new me, asp
- me.sp = asp
- puppetSprite(me.sp, 1)
- me.cst = the member of sprite me.sp
- me.pos = the loc of sprite me.sp
- cherWingObj = new(script("CherubWing Parent"), asp, pos)
- weightObj = new(script("Weight Parent"), asp, pos)
- cherubPicList = []
- makeList(me, cherubPicList, "Cherub")
- me.state = #normal
- lookDir = 1
- return me
- end
-
- on ChecKHits me, aObj
- if weightObj.state = #Drop then
- tempList = GetCherubHitList(aObj, weightObj.sp)
- if count(tempList) <> 0 then
- GetHitStates(me, tempList)
- end if
- end if
- end
-
- on GetHitStates me, aList
- case getAt(aList, 2) of
- #lever:
- CuePauseTimer(me, 8)
- end case
- end
-
- on CheckState me
- case me.state of
- #normal:
- #fly:
- fly(me)
- fly(cherWingObj)
- RandomChangePic(me)
- #released:
- MoveUp(me)
- fly(cherWingObj)
- #end:
- MoveUp(me)
- fly(cherWingObj)
- end case
- end
-
- on SetWingWeightPos me, aPos
- SetWingPos(cherWingObj, aPos)
- setWeightPos(weightObj, aPos)
- end
-
- on fly me
- FixTargetPoint(me)
- tempH = GetMoveHValue(me)
- tempV = GetMoveVValue(me)
- UpdatePos(me, point(tempH, tempV))
- end
-
- on GetMoveHValue me
- if me.pos.locH > targetPoint.locH then
- tempH = random(3) * -1
- return tempH
- end if
- if me.pos.locH < targetPoint.locH then
- tempH = random(3)
- return tempH
- end if
- end
-
- on GetMoveVValue me
- if me.pos.locV > targetPoint.locV then
- tempV = random(3) * -1
- return tempV
- end if
- if me.pos.locV < targetPoint.locV then
- tempV = random(3)
- return tempV
- end if
- end
-
- on FixTargetPoint me
- if the timer > targetTimer then
- CueTargetTimer(me, random(500) + 200)
- targetPoint = point(random(400) + 100, random(100) + 80)
- end if
- end
-
- on CueTargetTimer me, aNum
- targetTimer = the timer + aNum
- end
-
- on RandomChangePic me
- if the timer > picTimer then
- case lookDir of
- 1:
- LookRightPic(me, cherubPicList)
- 2:
- LookLeftPic(me, cherubPicList)
- 3:
- SwapCast(me, member("Cherub2"))
- CuePicTimer(me, random(80) + 20)
- end case
- end if
- end
-
- on LookRightPic me, aList
- tempPos = getOne(aList, me.cst)
- if tempPos = count(aList) then
- CuePicTimer(me, random(80) + 20)
- else
- SwapCast(me, getAt(aList, tempPos + 1))
- end if
- end
-
- on LookLeftPic me, aList
- tempPos = getOne(aList, me.cst)
- if tempPos = 1 then
- CuePicTimer(me, random(80) + 20)
- else
- SwapCast(me, getAt(aList, tempPos - 1))
- end if
- end
-
- on CuePicTimer me, aNum
- picTimer = the timer + aNum
- lookDir = random(3)
- end
-
- on MoveUp me
- if me.pos.locV < (worldObj.worldRect.top - 100) then
- me.state = #normal
- weightObj.state = #stop
- else
- UpdatePos(me, point(0, -3))
- end if
- end
-
- on GetTarget me, asp
- if asp = (me.sp + 2) then
- MoveTarget(weightObj)
- me.state = #released
- return me
- end if
- end
-
- on makeList me, aList, aName
- repeat with x = 1 to the maxinteger
- if the number of member (aName & x) > 0 then
- add(aList, member(aName & x))
- next repeat
- end if
- exit repeat
- end repeat
- end
-
- on SwapCast me, aMem
- me.cst = aMem
- set the member of sprite the sp of me to me.cst
- end
-
- on UpdatePos me, aPos
- tempPos = me.pos + aPos
- me.pos = tempPos
- UpdatePos(cherWingObj, aPos)
- CheckMyState(me, aPos)
- end
-
- on CheckMyState me, aPos
- case me.state of
- #fly:
- UpdatePos(weightObj, aPos)
- #released:
- if the timer > pauseTimer then
- UpdatePos(weightObj, point(0, weightObj.speed))
- end if
- #end:
- UpdatePos(weightObj, aPos)
- end case
- end
-
- on CuePauseTimer me, aNum
- pauseTimer = the timer + aNum
- end
-
- on DrawtoStage me
- set the loc of sprite the sp of me to me.pos
- DrawtoStage(cherWingObj)
- DrawtoStage(weightObj)
- end
-